#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int sum, k, q, pre, x;
set<int> A;
string s = "YES";
void solve() {
    cin >> q;
    for (int i = 1; i <= q; i++) {
        cin >> k; pre = 0; sum += k;
        for (int i = 1; i <= k; i++) {
            cin >> x;
            if (x <= pre) s = "NO";
            pre = x; A.insert(x);
        }
    }
    if (sum != A.size() || *A.rbegin() - *A.begin() + 1 != A.size()) s = "NO";
    cout << s << '\n';
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int _ = 1;
    // std::cin >> _;
    while (_--) {
        solve();
    }
    return 0;
}

